{extend name='admin@main'}


{block name="button"}

{if auth("add")}
<button data-open='{:url("add")}' data-title="新增记录" class='layui-btn layui-btn-sm layui-btn-primary'>新增记录</button>
{/if}
<!--
{if auth("remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些记录吗？" class='layui-btn layui-btn-sm layui-btn-primary'>删除</button>
{/if}-->

{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='holiday/my_index_search'}
    <table class="layui-table margin-top-10" lay-skin="switch" id="table">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='text-left nowrap'><button type="button" data-reload="" class="layui-btn layui-btn-xs">刷 新</button></th>
            <th class='text-left nowrap'>姓名</th>
            <th class='text-left nowrap'>值班/加班日期</th>
            <th class='text-left nowrap'>类型</th>
            <th >换休天数</th>
            
			<th class='text-center nowrap'>备注</th>			
            <th class='text-center nowrap'>使用状态</th>
             <!-- <th class='text-left nowrap'>创建时间</th> 
            <th class='text-left nowrap'>登录时间</th>-->
            <th class='text-left nowrap'>操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
            </td>
            <td class='text-left nowrap'>{$vo.id|default=''}</td>
            <td class='text-left nowrap'><a href="/admin.html#{:url('myduty')}?name={$vo.name}&leixing={:$request->get("leixing")}">{$vo.name|default='-'}</a></td>
			
            <td class='text-left nowrap'>{$vo.otdate|default='-'}</td>
            <td class='text-left nowrap'>
            {eq name='vo.datetype' value='zhiban'}<span class="color-red">值班</span>{/eq}
            {eq name='vo.datetype' value='jiaban'}<span class="color-blue">加班</span>{/eq}
            </td>
            <td id="lie">{$vo.buxiunum|default='0.0'}</td>
			
			
			<th class='text-center nowrap'>{$vo.remark|default=''}</th>
            <!-- <th class='text-center nowrap'>{$vo.yixiunum|default='0.0'}</th> -->
            <td class='text-center nowrap'>{eq name='vo.status' value='0'}<span class="color-green">未用</span>{/eq}
                {eq name='vo.status' value='-1'}<span class="color-blue">已用</span>{/eq}
                {eq name='vo.status' value='1'}<span class="color-blue">已撤销</span>{/eq}
            </td>
			
             <!--<td class='text-left nowrap'>{$vo.create_at|format_datetime}</td> -->
            <!-- <td class='text-left nowrap'>{if $vo.login_num>0}{$vo.login_at|format_datetime}{else} - {/if}</td> -->
            <td class='text-center nowrap'>



                {if auth("edit")}
                <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑用户" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
                {/if}
				

				

                {if $vo.status eq 0 and auth("forbid")}
                <a class="layui-btn layui-btn-sm layui-btn-normal" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('forbid')}">撤 销</a>
                {elseif $vo.status eq 1 and auth("resume")}
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('resume')}">恢 复</a>
                {/if}

				<!--
                {if auth("remove")}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该记录吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                {/if}
				-->

            </td>
        </tr>
        {/foreach}
		

        </tbody>
	
		
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}
	
	{$pagehtml|raw|default=''}{/empty}

</div>
<script src="__ROOT__/static/plugs/tablesum.js"></script>
<script type="text/javascript">



    function heji(table_id, lie, val_id) {
        //合计 --xpp
        //table_id： 要统计的table 的id值 
        //lie：要统计哪一列 
        //val_id：将合计值写入哪
        totalSou = 0;
        $("#"+table_id+" tbody tr").each(function () {
			var id =$('#table tr td:nth-child(6)').text();  
            var num = $($(this).find("td")[lie]).text();
			//console.log(id);
            totalSou += getNumValue(num);
        });
        $("#" + val_id).text(Number(totalSou.toFixed(4)));
    }
    function getNumValue(num) {
        if (!isNaN(num)) {
            num = parseFloat(num);
        }
        else {
            num = 0;
        }
        return num;
    }
	
$(function(){
	heji('table', '5', 'val_id');
});
</script>


<script type="text/javascript">
   //$('table').tableSum({'sumText':'total'})
</script>
{/block}
